package com.stottlerhenke.simbionic.samples.helloworld;

/**
 * <p>Title: </p>
 * <p>Description: This is a sample project designed to show you how to build a very simple "Hello World" program using SimBionic.
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Stottler Henke</p>
 * @author Jeremy Ludwig
 * @version 1.0
 */

import java.util.ArrayList;

import com.stottlerhenke.simbionic.api.SB_Exception;
import com.stottlerhenke.simbionic.api.SB_Interface;
import com.stottlerhenke.simbionic.api.SB_Param;



 /**
 * This class defines a simple interface between SimBionic and
 * our HelloWorld application.
 */
public class HelloWorld_Interface extends SB_Interface
{

  public HelloWorld_Interface()
  {
  }

  public SB_Param doPredicate(int predId, long entityId, ArrayList params)
  {
    SB_Param returnValue = new SB_Param();

    switch (predId)
    {
      case HelloWorld_Constants.PRED_HappinessLevel:
      {
        // since we have no real simulation, just make up
        // an arbitrary happiness level

        // set the return value for the predicate
        returnValue.setInteger( 87 );
      }
      break;
    }

    return returnValue;
  }

  public void doAction(int actionId, long entityId, ArrayList params) throws SB_Exception
  {
    switch (actionId)
    {
      case HelloWorld_Constants.ACTION_Say:
      {
      	// extract the first parameter, which is of type "string"
        String message = ((SB_Param) params.get(0)).getString();

        // now print the string to the console
        System.out.println(message);
      }
      break;
    }
  }

  public String getModuleName()
  {
    return new String("HelloWorld");
  }

  public ArrayList getModuleActions()
  {
    return new ArrayList();
  }

  public ArrayList getModulePredicates()
  {
    return new ArrayList();
  }
}